#!/bin/sh
# ��װ utofs
yum install -y autofs
# airdiskĿ¼
airdisk="/mnt/airdisk"
smbffine="/etc/smb.txt"
#��β��
sed -i '$a \/mnt/nas  /etc/smb.txt  --timeout 30' /etc/auto.master



apt-get install -y cifs-utils
 mount -t cifs -o username=admin,password=1813033378 //192.168.2.250/smb /mnt/samba

#���ӹ��������ļ�
echo "shell       -fstype=cifs,rw,username=smb,password=1813033378 ://192.168.2.253/shell" >> /etc/smb.txt

echo "smb       -fstype=cifs,rw,username=admin,password=1813033378 ://192.168.2.250/smb" > /etc/smb.txt














# ����Ŀ¼
smb="$airdisk/smb"
# img ���� ��� Ŀ¼
img="$smb/img"
# dockeer ���� �ļ� ·��
dockerdateimg="$img/docker-date.img"
# ���� Ӳ�̹����ļ�
cat > /etc/smb.txt << EOF
smb       -fstype=cifs,   username=admin,password=1813033378 ://192.168.2.250/smb
EOF



# ���ÿ�������
systemctl enable autofs

# ���� autofs ����
systemctl restart  autofs
# dockeer ����Ŀ¼
docker="$airdisk/docker"
#���� ���� ���� ���� ·��
mkdir -p $docker
# ���� /etc/docker/daemon.json
cat > /etc/docker/daemon.json << EOF

{
    "data-root": "$docker"
}

EOF
# ���� docker ����
systemctl start docker
systemctl restart  docker
# �������� docker
systemctl enable docker


alist="$smb/alist/data"
mkdir -p $alist
# alist ���̷���
docker run -d --restart=always \
-v $alist:/opt/alist/data \
-p 5244:5244 \
-e PUID=0 \
-e PGID=0 \
-e UMASK=022 \
--name="alist" \
xhofe/alist:latest

#�޸� alist ����Ա����
docker exec -it alist ./alist admin set 1813033378


mkdir -p "$docker/date/aria2/config"
mkdir -p "$smb/downloads/aria2"

# ��������
docker run -d --name aria2 --restart unless-stopped \
--log-opt max-size=1m \
-e PUID=$UID \
-e PGID=$GID \
-e UMASK_SET=022 \
-e RPC_SECRET=1813033378 \
-e RPC_PORT=6800 \
-e LISTEN_PORT=6888 \
-p 16800:6800 \
-p 16888:6888 \
-p 16888:6888/udp \
-v "$docker/date/aria2/config":/config \
-v "$smb/downloads/aria2":/downloads  p3terx/aria2-pro

